//
//  ReTableViewCell.m
//  海角音乐
//
//  Created by dllo on 15/8/6.
//  Copyright (c) 2015年 杨元石. All rights reserved.
//

#import "ReTableViewCell.h"

@implementation ReTableViewCell



- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {        
     
        self.backgroundColor =[UIColor clearColor];
    
        [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
        
        CGFloat X = 20*ADJUSTWIDTH; // 10
        CGFloat Y = 10*ADJUSTWIDTH;
        CGFloat width = 90*ADJUSTWIDTH; // 100
        
        _pic_url = [[UIImageView alloc] initWithFrame:CGRectMake(X, Y, width, width)];
        _pic_url.image = [UIImage imageNamed:@"share-default.png"];
        _pic_url.layer.masksToBounds = YES;
        _pic_url.layer.cornerRadius = width*0.06;
        [self.contentView addSubview:_pic_url];
        
        
        CGFloat name_X = SCREEN_WIDTH*0.346666667; // 130
        CGFloat name_Y = 20*ADJUSTWIDTH; // 30
        CGFloat name_width = SCREEN_WIDTH*0.53333333; // 200
        CGFloat name_height = SCREEN_WIDTH*0.08; // 30
        
        _name = [[UILabel alloc] initWithFrame:CGRectMake(name_X, name_Y, name_width, name_height)];
        _name.font =[UIFont boldSystemFontOfSize:16];
        _name.numberOfLines = 0;
        _name.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_name];
        
        
        CGFloat desc_Y = 60*ADJUSTWIDTH; // 70
        CGFloat desc_height = 30*ADJUSTWIDTH; // 20
        
        _desc = [[UILabel alloc] initWithFrame:CGRectMake(name_X, desc_Y, name_width, desc_height)];
        _desc.font = [UIFont boldSystemFontOfSize:15];
        _desc.numberOfLines = 0;
        _desc.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_desc];
        
        
        _line = [[UILabel alloc] initWithFrame:CGRectMake(name_X, Y+width+10*ADJUSTWIDTH, SCREEN_WIDTH-name_X, 1)];
        _line.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_line];
        
        
        [_line release];
        [_desc release];
        [_name release];
        [_pic_url release];

    }
    return self;
    
}



- (void)getDic:(RecommedModel *)reDicModel
{    
    _desc.text = reDicModel.desc;
    _name.text = reDicModel.name;    
    [_pic_url sd_setImageWithURL:[NSURL URLWithString:reDicModel.pic_url] placeholderImage:[UIImage imageNamed:@"share-default.png"]];
}

- (void)getDataDic:(NSDictionary *)dataDic
{
    _desc.text = [dataDic objectForKey:@"desc"];
    _name.text = [dataDic objectForKey:@"name"];
    [_pic_url sd_setImageWithURL:[NSURL URLWithString:[dataDic objectForKey:@"pic_url"]] placeholderImage:[UIImage imageNamed:@"share-default.png"]];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
